
const Router=require("koa-router")

const {verifyAuth,getPower}=require("../middleware/automiddleware")
const {create,detail,querylist,update,remove,addLabel}=require("../controller/moment_controller")
const {isExistLabel}=require("../middleware/labelmiddleware")
const {getFileByFilename}=require("../controller/file.controller")

const router=new Router()
//创建发表动态的路由
router.post("/moment",verifyAuth,create)
//根据id查询发表的动态
router.get("/moment/:monmentid",detail)
//查询所有动态
router.get("/moment",querylist)
//修改动态数据
router.patch("/moment/:momentid",verifyAuth,getPower,update);
//删除动态
router.delete("/moment/:momentid",verifyAuth,getPower,remove)
//给动态添加标签 
router.post("/moment/:momentid/labels",verifyAuth,getPower,isExistLabel,addLabel)
//查看动态图片信息
router.get("/moment/images/:filename",getFileByFilename)
module.exports=router